{include file="public/header" /}
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card welcome">
                <div class="layui-card-body">
                    <h2>欢迎回来 ：<span class="x-red">{$Think.cookie.u_name}</span>当前时间 ：<span id="now_time"></span></h2>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">数据统计</div>
                <div class="layui-card-body ">
                    <ul class="layui-row x-admin-backlog">
                        <li class="layui-col-md2 layui-col-xs6">
                            <a onclick="parent.xadmin.add_tab('产品管理','{:url(\'admin/product/index\',[\'node\'=>24])}')"
                               href="javascript:;" class="x-admin-backlog-body">
                                <h3>产品</h3>
                                <p><cite>{$product}</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a onclick="parent.xadmin.add_tab('新闻管理','{:url(\'admin/news/index\',[\'node\'=>17])}')"
                               href="javascript:;" class="x-admin-backlog-body">
                                <h3>新闻</h3>
                                <p><cite>{$news}</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6">
                            <a onclick="parent.xadmin.add_tab('案例管理','{:url(\'admin/solution/index\',[\'node\'=>16])}')"
                               href="javascript:;" class="x-admin-backlog-body">
                                <h3>案例</h3>
                                <p><cite>{$solution}</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-md2 layui-col-xs6 ">
                            <a onclick="parent.xadmin.add_tab('询盘消息','{:url(\'admin/Inquiry/index\',[\'node\'=>53])}')"
                               href="javascript:;" class="x-admin-backlog-body">
                                <h3>总询盘数</h3>
                                <p><cite>{$inquiry}</cite></p>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-lg6 layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">近30日访问量</div>
                <div id="pvCharts"></div>
                <input type="hidden" value="{$pv}" id="pv">
                <input type="hidden" value="{$last_thirty_day}" id="lastThirtyDay">
            </div>
        </div>

        <div class="layui-col-lg6 layui-col-md6">
            <div class="layui-card not-read-inquiry">
                <div class="layui-card-header">最新询盘<span><a onclick="parent.xadmin.add_tab('询盘消息','{:url(\'admin/Inquiry/index\',[\'node\'=>53])}')" href="javascript:;">更多 > </a></span></div>
                <div id="notReadMessage">
                    <ul>
                        {volist name="not_read_inquiry" id="vo"}
                        <li data-inquiry="{$vo.id}">
                            <div>{$vo.message}</div>
                            <div>{$vo.create_time|date="Y-m-d H:i:s"}</div>
                        </li>
                        {/volist}
                    </ul>
                </div>
            </div>
        </div>

        <!-- <div class="layui-col-md6">
            <div class="layui-card server-information">
                <div class="layui-card-header">服务器环境</div>
                <ul>
                    <li>PHP版本 ：{$server_information.php_version}</li>
                    <li>数据库类型 ：{$server_information.database}</li>
                    <li>运行环境 ：{$server_information.os} + {$server_information.server_software}</li>
                    <li>PHP拓展 ： fileinfo{if $server_information.ext_file_info == true}<i class="fa fa-check"></i>{else /}<i class="fa fa-close"></i>{/if}
                        openssl{if $server_information.ext_openssl == true}<i class="fa fa-check"></i>{else /}<i class="fa fa-close"></i>{/if}</li>
                </ul>
            </div>
        </div> -->
    </div>
</div>
<script src="/static/echarts/echarts.min.js"></script>
<script>
    var pvVal = JSON.parse($('#pv').val())
    var lastThirtyDay = JSON.parse($('#lastThirtyDay').val())
    
    function now_time() {
        var vWeek, vWeek_s, vDay;
        vWeek = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
        var date = new Date();
        year = date.getFullYear();
        month = date.getMonth() + 1;
        day = date.getDay();
        hours = date.getHours();
        minutes = date.getMinutes();
        seconds = date.getSeconds();
        vWeek_s = date.getDay();
        document.getElementById('now_time').innerHTML = year + "年" + month + "月" + day + "日" + "\t" + hours + ":" + minutes + ":" + seconds + "\t" + vWeek[vWeek_s];
    }

    setInterval("now_time()", 1000);

    var pv = echarts.init(document.getElementById('pvCharts'));

    var pvOption = {
        xAxis: {
            type: 'category',
            data: lastThirtyDay
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                data: pvVal,
                type: 'line',
                //数据点显示具体数值，需和下方emphasis搭配使用
                label: {
                    show:false
                },
                //鼠标悬浮在数据点上才显示具体数值
                emphasis:{
                    label:{
                        show: true
                    }
                }
            }
        ]
    }

    pv.setOption(pvOption)

    //响应容器大小的变化
    window.onresize = function () {
        pv.resize()
    }

    $('#notReadMessage ul li').on('click',function () {
        let msgId = $(this).attr('data-inquiry')
        let msgUrl = "{:url('inquiry/details')}?id=" + msgId
        xadmin.open('查看',msgUrl)
    })
</script>
</body>
</html>